package com.greenyoung.pwiki.elasticsearch.index;

import com.greenyoung.pwiki.elasticsearch.index.event.DoIndexReceiver;
import com.greenyoung.pwiki.elasticsearch.index.utils.PipelineUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

@SpringBootApplication
public class PwikiElasticsearchIndexApplication {

    public static Logger logger = LoggerFactory.getLogger(PwikiElasticsearchIndexApplication.class);

    public static void main(String[] args) throws InterruptedException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(PwikiElasticsearchIndexApplication.class, args);
        Logger logger = LoggerFactory.getLogger(PwikiElasticsearchIndexApplication.class);

        logger.info(applicationContext.getEnvironment().getProperty("my-nacos-config-test"));

        try {
            PipelineUtils.checkAndCreatePipeline();
        } catch (
                IOException e) {
            logger.error("[!] 项目初始化，检查el管道时出现异常，异常信息：" + e.getMessage());
        }
        //TODO:创建mapping

    }
}

